﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Search.aspx.vb" Inherits="WSADProject.Search" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
    <p>
       
    </p>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
     <asp:TextBox ID="txtfindprofile" runat="server"></asp:TextBox>
        <asp:Button ID="Button2" runat="server" Text="Search Profiles" Width="202px" /><br />
     <asp:TextBox ID="txtfinddiscus" runat="server"></asp:TextBox>
        <asp:Button ID="Button3" runat="server" Text="Search Discussion" Width="202px" />
    
    <asp:GridView ID="GridView1" runat="server" BorderStyle="Solid" BorderWidth ="1" BorderColor ="WhiteSmoke" AllowPaging="True" AutoGenerateColumns="False" Height="217px">
        <Columns>
            <asp:TemplateField HeaderText="User" SortExpression="UserName">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("UserName") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                  <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ='<%# String.Format("details.aspx?id={0}", Eval("UserID"))%>'><%# Eval("UserName")%>  </asp:HyperLink>
                      </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
            <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
            <asp:BoundField DataField="LastActivityDate" DataFormatString="{0:d}" HeaderText="Last Activity Date" SortExpression="LastActivityDate" />
        </Columns>
     </asp:GridView>
     
     <br />
     <asp:GridView ID="GridView2" runat="server" BorderStyle="Solid" BorderWidth ="1" BorderColor ="WhiteSmoke" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="DiscussionID" Width="580px">
         <Columns>
             <asp:BoundField DataField="DiscussionID" HeaderText="DiscussionID" InsertVisible="False" ReadOnly="True" SortExpression="DiscussionID" Visible="False" />
             <asp:TemplateField HeaderText="Topic" SortExpression="DiscussionSubject">
                 <EditItemTemplate>
                     <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DiscussionSubject") %>'></asp:TextBox>
                 </EditItemTemplate>
                 <ItemTemplate>
                       <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ='<%# String.Format("~/Discussreply.aspx?DiscusID={0}", Eval("DiscussionID"))%>' ><%# Eval("DiscussionSubject") %> </asp:HyperLink> </ItemTemplate>
             </asp:TemplateField>
             <asp:BoundField DataField="Username" HeaderText="Created by" SortExpression="Username" />
             <asp:BoundField DataField="CreatedDate" DataFormatString="{0:d}" HeaderText="Created Date" SortExpression="CreatedDate" />
             <asp:BoundField DataField="CreatedTime" DataFormatString="{0:T}" HeaderText="Created Time" SortExpression="CreatedTime" />
         </Columns>
     </asp:GridView>
     <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:fishconn %>" ProviderName="<%$ ConnectionStrings:fishconn.ProviderName %>" SelectCommand="SELECT * FROM [tblDiscussion] WHERE ([DiscussionSubject] LIKE '%' + ? + '%') ORDER BY [CreatedDate] DESC, [CreatedTime] DESC">
         <SelectParameters>
             <asp:ControlParameter ControlID="txtfindprofile" Name="DiscussionSubject" PropertyName="Text" Type="String" />
         </SelectParameters>
     </asp:SqlDataSource>
     
    </asp:Content>
